const {override, fixBabelImports, addLessLoader} = require('customize-cra');
module.exports = function override(config, env) {
    // do stuff with the webpack config...
    return config;
};

module.exports = override(
    // 针对antd 实现按需打包：根据import来打包 (使用babel-plugin-import)
    fixBabelImports('import', {
        libraryName: 'antd-mobile',
        style: 'css',
    }),
    // 使用less-loader对源码重的less的变量进行重新制定，设置antd自定义主题
    // addLessLoader({
    //     javascriptEnabled: true,
    //     modifyVars: {'@primary-color': '#1DA57A'},
    // })

    // 6.0刚出好像兼容方面有点问题，改成
    addLessLoader({
        lessOptions: {
            modules:true,
            javascriptEnabled: true,
            modifyVars: {'@primary-color': '#1DA57A'},
            cssModules:{
                localIdentName: "[path][name]__[local]--[hash:base64:5]", // if you use CSS Modules, and custom `localIdentName`, default is '[local]--[hash:base64:5]'.
            }
        },
    })
)
;